<?php
include('product_model.php');
if (isset($_POST) && isset($_POST['post-comment']))
	{
	 	$productid=$_POST['proid'];
		$name=$_POST['txtName'];
		$content=$_POST['content'];
		$email=$_POST['txtEmail'];
		$isvisable=0;
		$i=$_POST['i'];
		$nowdate=getdate();
		$date=$nowdate['year'].'-'.$nowdate['mon'].'-'.$nowdate['mday'];
		$rl=InsertComment($content, $name, $email, $productid, $date, $isvisable);
		
		header('location:/cfshop/Product/ProductDetail.php?i='.$i);
		
		
		
	}
	if (isset($_GET) &&$_GET['acc']=='delete')
	{
	 	
		$id=$_GET['cmid'];
		$i=$_GET['prid'];
		deleteComment($id);
		header("location:/cfshop/Product/ProductDetail.php?i=".$i);
		
		
	}
	if (isset($_GET) &&$_GET['acc']=='show')
	{
	 	
		$id=$_GET['cmid'];
		updateComment($id,1);
/*		
*/		
		$i=$_GET['prid'];
		header("location:/cfshop/Product/ProductDetail.php?i=".$i);
		
	}
	if (isset($_GET) &&$_GET['acc']=='unshow')
	{
	 	$i=$_GET['prid'];
		$id=$_GET['cmid'];
		updateComment($id, 0);		
		header("location:/cfshop/Product/ProductDetail.php?i=".$i);
		
		
	}
?>